package HTMLParser;

import java.io.IOException;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class HTMLParserExample5 {

	public static void main(String[] args) {
		StringBuffer stbEN = new StringBuffer();
		StringBuffer stbVN = new StringBuffer();
		Document doc;
		
		try {

			// get all images
			doc = Jsoup
					.connect(
							"http://tratu.vietgle.vn/hoc-tieng-anh/cap-cau-song-ngu/vietgle-tra-tu/tat-ca/trang-4.html")
					.get();
			// p10l icham

			Elements byClass = doc.getElementsByClass("icham");
			Elements byClass_vi = doc.getElementsByClass("p10l");
			for (Element byClas : byClass) {
				// System.out.println(byClas.ownText());
				stbEN.append(byClas.ownText());
				stbEN.append("\n");
			}
			for (Element byClass_vi_e : byClass_vi) {
				// System.out.println(byClass_vi_e.ownText());
				stbVN.append(byClass_vi_e.ownText());
				stbVN.append("\n");
			}

		} catch (IOException e) {
			e.printStackTrace();
		}
		System.out.println(stbEN.toString());
		System.out.println(stbVN.toString());

	}
}
